<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var arr = [4,6,34,6,2]
        // arr.forEach(function(item,index,array){
        //     console.log(item,index)
        //     console.log(array)
        // })

        //用来修改数组
        var arr1 = arr.map(function(item,index,array){
            if(item < 10 ){
                return index * 2 
            }
            return item
        })
        console.log(arr1)
    </script>
</body>
</html>